package com.charley.icloud.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户信息（MybatisPlus)
 * @author charley
 * @date 2024-04-16 14:59
 * */

@Data
@TableName("sys_user")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SysUserEntity implements Serializable {
    private static final long serialVersionUID = -5144055068797033748L;

    /**
     * 编号 自增
     * */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 账号
     * */
    @TableField(value = "account")
    private String account;

    /**
     * 显示名称
     * */
    @TableField(value = "nickname")
    private String nickname;

    /**
     * 用户名
     * */
    @NotBlank(message = "用户名不能为空")
    @TableField(value = "username")
    private String username;

    /**
     * 密码
     * */
    @TableField(value = "password")
    private String password;

    /**
     * 加密盐
     * */
    @TableField(value = "salt")
    private String salt;

    /**
     * 状态 0正常 1禁用 2已删除
     * */
    @TableField(value = "status")
    private Integer status = 0;

    /**
     * 是否为管理员
     * */
    @TableField(value = "admin")
    private Boolean admin;

    /**
     * 头像
     * */
    @TableField(value = "avatar")
    private String avatar;

    /**
     * 邮箱
     * */
    @TableField(value = "email")
    private String email;

    /**
     * 手机号
     * */
    @TableField(value = "mobile_phone_number")
    private String mobilePhoneNumber;

    /**
     * 最后登录时间
     * */
    @TableField(value = "last_login")
    private Date lastLogin;

    /**
     * 创建时间
     * */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "zh",timezone = "GMT+8")
    @TableField(value = "created_time")
    private Date createdTime;

    /**
     * 创建人用户名
     * */
    @TableField(value = "created_by")
    private String createdBy;

    /**
     * 更新时间
     * */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "zh",timezone = "GMT+8")
    @TableField(value = "updated_time")
    private Date updatedTime;

    /**
     * 更新人用户名
     * */
    @TableField(value = "updated_by")
    private String updatedBy;

    /**
     * 是否删除
     * */
    @TableField(value = "deleted")
    private Boolean deleted;

}

